/*
 *@Author: 张楚
 *@Date: 2021-08-09 21:01:07
 *@Description: 拖拽
*/
import 'package:flutter/material.dart';

class ReorderableListViewPage extends StatefulWidget {
  const ReorderableListViewPage({Key key}) : super(key: key);
  @override
  _ReorderableListViewPageState createState() =>
      _ReorderableListViewPageState();
}

class _ReorderableListViewPageState extends State<ReorderableListViewPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ss'),
      ),
      body: ReorderableListView(
        header: Text(
          '我是头部，不能移动',
          style: Theme.of(context).textTheme.headline4,
        ),
        onReorder: (int oldIndex, int newIndex) =>
            print('从$oldIndex 到 $newIndex'),
        children: List.generate(
            20,
            (index) => Text(
                  'index is $index',
                  style: Theme.of(context).textTheme.headline6,
                  key: UniqueKey(),
                )),
      ),
    );
  }
}
